
libs=libparseyaml.so

LIBS = -lyaml -lbsd -g -Wall
DLFLAGS = -shared -fPIC

%.o: %.c
	gcc -fPIC -o $@ -c $^ -g


.PHONY: all
.PHONY: install
.PHONY: clean
.PHONY: uninstall
.PHONY: test

all: $(libs)

libparseyaml.so: conf-yaml.o conf-yaml-loader.o
	gcc $(DLFLAGS) -o $@ $^ $(LIBS)

install: $(libs)
	\cp $(libs)	/usr/local/lib/
	\cp conf-yaml.h conf-yaml-loader.h queue.h /usr/local/include/
	\ldconfig

test: test/tt.o
	gcc -o tt $< -lparseyaml $(LIBS)

clean:
	\rm -f test/*.o *.o tt $(libs)

uninstall:
	\rm -f /usr/local/lib/$(libs)
	\rm -f /usr/local/include/conf-yaml.h /usr/local/include/conf-yaml-loader.h /usr/local/include/queue.h
	\ldconfig

